package com.csxy.hql.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Schema(name = "EduCourse对象",description = "课程信息")
@TableName("edu_course") // 指定对应的数据库表名
public class EduCourse implements Serializable {
    private static final long serialVersionUID = 1L;

    @Schema(description = "课程ID")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private String id;

    @Schema(description = "课程讲师ID")
    private String teacherId; // 对应 teacher_id 字段

    @Schema(description = "课程专业ID")
    private String subjectId; // 对应 subject_id 字段

    @Schema(description = "课程专业父级ID")
    private String subjectParentId; // 对应 subject_parent_id 字段

    @Schema(description = "课程标题")
    private String title;

    @Schema(description = "课程销售价格，设置为0免费观看")
    private BigDecimal price; // decimal(10,2) 对应 BigDecimal

    @Schema(description = "总课时")
    private Integer lessonNum;

    @Schema(description = "课程封面图片路径")
    private String cover;

    @Schema(description = "销售数量")
    private Long buyCount;

    @Schema(description = "浏览数量")
    private Long viewCount;

    @Schema(description = "乐观锁")
    @Version // 乐观锁注解
    private Long version;

    @Schema(description = "课程状态 Draft未发布 Normal已发布")
    private String status;

    @Schema(description = "逻辑删除 1（true）已删除，0（false）未删除")
    @TableLogic // 逻辑删除注解
    private Integer isDeleted = 0;

    @Schema(description = "创建时间", example = "2020-01-01 00:00:00")
    @TableField(fill = FieldFill.INSERT)
    private Date gmtCreate;

    @Schema(description = "更新时间", example = "2020-01-01 00:00:00")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date gmtModified;
}